.filter-modal-conditions {
    display: table;
    table-layout: fixed;
    width: 100%;

    & * {
        box-sizing: border-box;
    }
}

.filterModal-add-condition-button {
    margin-top: 1em;
}

.filter-modal-condition {
    min-width: 100%;
    display: flex;
    padding-right: 15px;
    overflow: initial
}

.filter-modal-condition-if {
    @include flexInline();
    @include flexAlignCenter();
    height: 34px;
    padding-right: .5rem;
}

.filter-modal-condition-attachments {
    @include flexInline();
}

.filter-modal-condition-attachments label {
    margin-left: .5rem;
}
.filter-modal-condition-settings-container {
    display: table-cell;
    width: calc(100% - 55px);
}

.filter-modal-condition-settings {
    display: flex;
    @include flexWrap();
    @include flexAlignCenter();
    overflow: initial;
    min-width: 0;
}


.filter-modal-condition-settings-item {
    max-width: 100%;
}
.filter-modal-add-condition-autocomplete { position: relative }


.filter-modal-simple-condition { width: 100% }
.filter-modal-condition-remove {
    display: table-cell;
    width: 55px;
}

/* badges */
.filter-modal-condition-badges {
    // @include flexInline();
    @include flexAlignCenter();
    display: flex;
    flex-wrap: wrap;
}
.filter-modal-condition-badges * {
    min-width: 0;
}

.filter-modal-condition-badge {
    line-height: 2;
    height: auto;
    max-width: 100%;
    display: flex;
}
.filter-modal-condition-badge-value {
    max-width: 100%;
    flex-wrap: nowrap;
}
.filter-modal-condition-badge-remove {
    flex: 0 0 10px;
    padding-left: 5px;
}

.filter-modal-condition-or {
    margin: 0 .5rem;
    font-size: 75%;
    flex: 0 0 45px;
}

/* condition pattern */
.filter-modal-add-condition {
    @include flexInline();
    flex-basis: 15rem;
}
.filter-modal-add-condition-input { width: 12rem }
.filter-modal-add-condition-button {
    margin-left: -4px;
    width: 40px;
    background: $primary;
    border-color: transparent;
    color: $white;
}

.filter-modal-add-condition-button:hover {
    background: $primary;
    border-color: transparent;
    color: $white;
}

.filter-modal-add-condition-button[disabled] {
    background: darken(#f7f7f7, 5);
    border-color: rgba(0,0,0,0.2);
    opacity: 1;
    color: rgba(0,0,0,0.4)
}

/* separator */
.filter-modal-separator {
    @include flexInline();
    @include flexAlignCenter();
    height: 35px;
}

/* Labels */
.filter-modal-label-container,
.filter-modal-vacation,
.filter-modal-markdetails {
    border: 1px solid transparent;
}

.filter-modal-label-container {
    @include flexRow();
    @include flexWrap();
}

.filter-modal-label,
.filter-modal-label-add { min-height: 3rem }
.filter-modal-label i { margin: 0.1rem 0.5rem 0.1rem 0 }
.filter-modal-label-add {
    @include flexInline();
    @include flexAlignCenter();
}


/* spacing */
.filter-modal-condition-settings > *,
.filter-modal-condition-remove,
.filter-modal-separator > * { margin:.2rem }

.filter-modal-simple .filter-complex-only  {
        display: none;
}

.filter-modal-simple [data-squire-actions="moreToggle"] {
    display: none;
}

[data-validity*="sieve"] [id="filterScriptContainer"] .CodeMirror,
[data-validity*="conditions"] [data-mode="conditions"],
[data-validity*="action"] [data-mode="action"],
[data-validity*="actions:labels"] [data-mode="action"] .filter-modal-label-container,
[data-validity*="actions:mark"] [data-mode="action"] .filter-modal-markdetails,
[data-validity*="actions:vacation"] [data-mode="action"] .filter-modal-vacation,
[data-validity*="noaction"] [data-mode="action"] .filterModal-checkbox label {
    border-color: $red;
}

[data-validity*="action"] [data-mode="action"] legend,
[data-validity*="conditions"] [data-mode="conditions"] legend {
    color: $red;
}

/* float switching to give each column there own rows doesn't work in flex boxes */
body.appConfigBody-is-mobile .filter-modal-complex {

    .sieve-script {
        flex-direction: column;
    }

    .modal-dialog {
        height: 100%;
        min-height: 700px;
    }

}

.filter-modal-complex {
    .filter-simple-only {
        display: none;
    }

    .modal-dialog,
    .modal-content,
    .modal-body,
    .sieve-script,
    .sieve-script #filterScriptContainer {
        display: flex;
    }

    .modal-dialog,
    .modal-content,
    .modal-body  {
        flex-direction: column;
    }

    .modal-dialog {
        height: calc(100% - 6rem);
        /*
            Needed to make the responsive layout still work
         */
        min-height: 600px;
    }

    .modal-content,
    .modal-body,
    .sieve-script,
    .sieve-script #filterScriptContainer {
        flex-grow: 1;
    }

    .CodeMirror {
        height: 100%;
    }

    /*
     * Get out of the flex chain, we use position: relative instead of height: 100%, because for some reason, height doesn't
     * work on iOS.
     */
    #filterScriptContainer {
        position: relative;
    }

    #filterScript {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
    }
}
